package com.linkstec.kafka;

import java.util.Map;
import java.util.Properties;

import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.common.TopicPartition;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import kafka.admin.AdminClient;

public class AdminClientTest {
	private static final Logger logger = LogManager.getLogger();

	private static final String bootstrapServers = "192.168.2.235:9092,192.168.2.236:9092,192.168.2.237:9092";
	private static AdminClient adminClient;
	
	public static void main(String[] args) {
		Properties properties = new Properties();
	    properties.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
	    adminClient = AdminClient.create(properties);
	    
		String groupId = "MOT_DEV_E_EVENT_FLOW_GROUP_1";
		
		Map<TopicPartition, Object> offsets = scala.collection.JavaConversions.mapAsJavaMap(adminClient.listGroupOffsets(groupId));
        for (Map.Entry<TopicPartition, Object> entry : offsets.entrySet()) {
        	logger.info("key= " + entry.getKey() + " and value= " + entry.getValue());    
     	  }
        
	}
}